<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>Tcl_CreateCloseHandler manual page - Tcl Library Procedures</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tcl C API</a> <small>&gt;</small> CrtCloseHdlr</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<DL>
<DD><A HREF="CrtCloseHdlr.htm#M2" NAME="L145">NAME</A>
<DL><DD>Tcl_CreateCloseHandler, Tcl_DeleteCloseHandler &mdash; arrange for callbacks when channels are closed</DD></DL>
<DD><A HREF="CrtCloseHdlr.htm#M3" NAME="L146">SYNOPSIS</A>
<DL>
<DD><B>#include &lt;tcl.h&gt;</B>
<DD>void
<DD><B>Tcl_CreateCloseHandler</B>(<I>channel, proc, clientData</I>)
<DD>void
<DD><B>Tcl_DeleteCloseHandler</B>(<I>channel, proc, clientData</I>)
</DL>
<DD><A HREF="CrtCloseHdlr.htm#M4" NAME="L147">ARGUMENTS</A>
<DL class="arguments">
</DL>
<DD><A HREF="CrtCloseHdlr.htm#M5" NAME="L148">DESCRIPTION</A>
<DD><A HREF="CrtCloseHdlr.htm#M6" NAME="L149">SEE ALSO</A>
<DD><A HREF="CrtCloseHdlr.htm#M7" NAME="L150">KEYWORDS</A>
</DL>
<H3><A NAME="M2">NAME</A></H3>
Tcl_CreateCloseHandler, Tcl_DeleteCloseHandler &mdash; arrange for callbacks when channels are closed
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tcl.h&gt;</B><BR>
void<BR>
<B>Tcl_CreateCloseHandler</B>(<I>channel, proc, clientData</I>)<BR>
void<BR>
<B>Tcl_DeleteCloseHandler</B>(<I>channel, proc, clientData</I>)<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL class="arguments">
<DT><A HREF="../TclLib/OpenFileChnl.htm">Tcl_Channel</A> <B>channel</B> (in)<DD>
The channel for which to create or delete a close callback.
<P><DT>Tcl_CloseProc <B>*proc</B> (in)<DD>
The procedure to call as the callback.
<P><DT>ClientData <B>clientData</B> (in)<DD>
Arbitrary one-word value to pass to <I>proc</I>.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
<B>Tcl_CreateCloseHandler</B> arranges for <I>proc</I> to be called when
<I>channel</I> is closed with <B><A HREF="../TclLib/OpenFileChnl.htm">Tcl_Close</A></B> or
<B><A HREF="../TclLib/OpenFileChnl.htm">Tcl_UnregisterChannel</A></B>, or using the Tcl <B><A HREF="../TclCmd/close.htm">close</A></B> command.
<I>Proc</I> should match the following prototype:
<P>
<PRE>typedef void <B>Tcl_CloseProc</B>(
        ClientData <I>clientData</I>);</PRE>
<P>
The <I>clientData</I> is the same as the value provided in the call to
<B>Tcl_CreateCloseHandler</B>.
<P>
<B>Tcl_DeleteCloseHandler</B> removes a close callback for <I>channel</I>.
The <I>proc</I> and <I>clientData</I> identify which close callback to
remove; <B>Tcl_DeleteCloseHandler</B> does nothing if its <I>proc</I> and
<I>clientData</I> arguments do not match the <I>proc</I> and <I>clientData</I>
for a  close handler for <I>channel</I>.
<H3><A NAME="M6">SEE ALSO</A></H3>
<B><A HREF="../TclCmd/close.htm">close</A></B>, <B><A HREF="../TclLib/OpenFileChnl.htm">Tcl_Close</A></B>, <B><A HREF="../TclLib/OpenFileChnl.htm">Tcl_UnregisterChannel</A></B>
<H3><A NAME="M7">KEYWORDS</A></H3>
<A href="../Keywords/C.htm#callback">callback</A>, <A href="../Keywords/C.htm#channel closing">channel closing</A>
<div class="copy">Copyright &copy; 1994-1996 Sun Microsystems, Inc.
</div>
</BODY></HTML>
